using UnityEngine;
using System.Collections;



public class ControllerMaster : MonoBehaviour {
	public Transform cameraObject;
	public enum ControllerType{
			none,freeCamera
			}
	public ControllerType currentControllerType =  ControllerType.freeCamera;
	private ControllerType useController = ControllerType.freeCamera;
	private ControllerFree freeController;


	void Start () {
		freeController = this.gameObject.GetComponent<ControllerFree>() as ControllerFree;
		StateManager.GetInstance().Init();
		UpdateState();
	}

	void FixedUpdate() {
		StateManager.GetInstance().FixedUpdate();
	}

	void LateUpdate () {
		bool resetController = false;
		if (currentControllerType != useController){
			resetController = true;
		}
		
		
		if (resetController){
			UpdateState();
			resetController = false;
			useController = currentControllerType;
		}
	}

	void UpdateState()
	{
		switch(currentControllerType)
		{
			case ControllerType.none:
			{
				freeController.isActive = false;
			}
			break;
			case ControllerType.freeCamera:
			{
				freeController.isActive = true;
			}
			break;
		}
	}

}